#pragma once

#define IDT_ENTRIES_COUNT	256

typedef void (*PISR)();


typedef struct 
{
	WORD offset_1;	// offset bits 0..15
	WORD selector;	// a code segment selector in GDT or LDT
	BYTE zero;      // unused, set to 0
	BYTE type_attr; // type and attributes, see below
	WORD offset_2;	// offset bits 16..31
}IDT_ENTRY, *PIDT_ENTRY;

class IDT
{
private:
	bool m_isActive;

	IDT_ENTRY m_entries[IDT_ENTRIES_COUNT];

private:
	void SetISRHandler(BYTE id, PISR pIsr, BYTE attrib);

public:
	IDT();
	~IDT();


	void Activate();
	void Deactivate();

	void SetSys32ISRHandler(BYTE id, PISR pIsr);
};